package huixue.cn.com.rxapp.ui;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;


import com.orhanobut.logger.Logger;

import huixue.cn.com.rxapp.R;
import huixue.cn.com.rxapp.base.BaseActivity;
import huixue.cn.com.rxapp.base.BasePresent;
import huixue.cn.com.rxapp.base.SimpleActivity;
import huixue.cn.com.rxapp.login.ui.LoginActivity;
import huixue.cn.com.rxapp.util.LogUtils;
import io.reactivex.Observable;

public class TestActivity extends SimpleActivity {

    @Override
    public int getLayout() {
        return R.layout.activity_test;
    }

    @Override
    public void initView() {
        /*Toolbar toolbar = findViewById(R.id.toolbar);

        toolbar.setTitle("This is Title");*/
    }

    @Override
    public void addEvent() {
    }

    /*@Override
    protected void onResume() {
        super.onResume();
        //

        new Thread(new Runnable() {
            @Override
            public void run() {
                mLeakHandler.sendEmptyMessageDelayed(0x1,5000);
                //finish();
            }
        }).start();
    }*/

    /*private Handler mLeakHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            Logger.d(msg.toString());
        }
    };*/
    private Handler mLeakHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
        }
    };

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        LogUtils.e("TestActivity==onCreate==");
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        LogUtils.e("TestActivity==onSaveInstanceState==");
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        LogUtils.e("TestActivity==onRestoreInstanceState==");
    }

    @Override
    protected void onStart() {
        super.onStart();
        LogUtils.e("TestActivity==onStart==");
    }

    @Override
    protected void onResume() {
        super.onResume();
        LogUtils.e("TestActivity==onResume==");
        new Thread(new Runnable() {
            @Override
            public void run() {
                mLeakHandler.sendEmptyMessageDelayed(0x1,5000);
                //finish();
            }
        }).start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        LogUtils.e("TestActivity==onPause==");
    }

    @Override
    protected void onStop() {
        super.onStop();
        LogUtils.e("TestActivity==onStop==");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        LogUtils.e("TestActivity==onDestroy==");
    }

    public void entryLoginAction(View view){
        Intent intent = new Intent(this, TestActivity.class);
        startActivity(intent);
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        LogUtils.e("TestActivity==onNewIntent==");
    }
}
